package com.sh.rbac.core.mybatis.context;

import net.sf.jsqlparser.expression.Expression;

/**
 * 数据权限上下文
 *
 * @author wb
 * @since 2025-05-18
 */
public class DataPermissionContext {

    private static final ThreadLocal<Expression> DATA_PERMISSION_HOLDER = new ThreadLocal<>();

    public static void setCurrentExpression(Expression expr) {
        DATA_PERMISSION_HOLDER.set(expr);
    }

    public static Expression getCurrentExpression() {
        return DATA_PERMISSION_HOLDER.get();
    }

    public static void clear() {
        DATA_PERMISSION_HOLDER.remove();
    }
}
